# Contributor: Dennis Krupenik <dennis@krupenik.com>
# Maintainer: Dennis Krupenik <dennis@krupenik.com>
pkgname=intel-compute-runtime
pkgver=21.09.19150
pkgrel=0
pkgdesc="Intel® Graphics Compute Runtime for oneAPI Level Zero and OpenCL™ Driver"
url="https://github.com/intel/compute-runtime"
arch="x86_64"
license="MIT"
depends_dev="intel-gmmlib-dev intel-graphics-compiler-dev libexecinfo-dev libva-dev"
makedepends="$depends_dev cmake"
subpackages="$pkgname-dev"
source="https://github.com/intel/compute-runtime/archive/$pkgver/compute-runtime-$pkgver.tar.gz
	link-execinfo.patch
	pthread-yield.patch
	remove-rtld-deepbind.patch
	remove-select.patch"
builddir="$srcdir/compute-runtime-$pkgver"
options="!check" # runs unit tests in preinstall

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DSKIP_UNIT_TESTS=1 \
		$CMAKE_CROSSOPTS .
	nice make -C build -j"$(nproc)"
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="e512e577a835dfe384b6187e687cadf663f7a4f5d720ed8df36c20e735083b99c5467f9ee2f0ceb12db6b4b0522e761f2dbeee2832ce7ccc03f5a520f72d790e  compute-runtime-21.09.19150.tar.gz
5cf4bb4114ffc9940e20f3d3f21edb5b1e6f9157b38c4232cb16ff7fb52e36eedb26b008ed5801c257233375315a950e4e6e47756be01ca9787a1b6f42fbe369  link-execinfo.patch
855284aad45809046266e0def176f16f28dcd08154d39ffd2e34c92127f52da0f24a5679ec1d5005369f878a9947e69c21fd34cda31b636d04d055956b3cf06b  pthread-yield.patch
5b63d5a480fa72353cf6229d77391163631cdb00e1ce444d75d3681128468726df9f74eb3b44eebd47d62fb2779a61d12d983ebe38902d063a7e54ea3347a52a  remove-rtld-deepbind.patch
8ee0f776f06858cedaed0194618030eb7d0e27e27b7488daf975e3f6eb6df378461b93a300ecd68366ded2ec28d7c53ee35711e2c9cbe2c8634423bb03e9cf57  remove-select.patch"
